Add univariate vs multivariate model comparison#63
Merged
ShixiangWang merged 12 commits intomainfrom Jan 18, 2026
Merged
Conversation
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Co-authored-by: ShixiangWang <25057508+ShixiangWang@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add construction and comparison of single and multiple variable models
Add univariate vs multivariate model comparison
Jan 18, 2026
Refactored R/08-compare.R for improved code clarity and consistency, mainly adjusting whitespace and minor formatting. Deleted the generated README.html file. Updated related test files to align with the refactored code.
Updated the DESCRIPTION file to suggest 'qs2' instead of 'qs'. Modified R/03-accessors.R to use 'qs2::qread' and check for 'qs2' package instead of 'qs'. This ensures compatibility with the 'qs2' package for model reading functionality.
Updated code to use the qs2 package instead of the deprecated qs package. Changed function calls from qs2::qsave/qread to qs2::qs_save/qs_read in pipeline and accessor functions. Updated NEWS.md to document the change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements simultaneous construction and side-by-side comparison of univariate (each predictor separately) and multivariate (all predictors together) regression models, similar to autoReg package functionality.
Changes
br_compare_models(): Builds both model types in one call, returnsbreg_comparisonobject with combined results tagged by modebr_show_forest_comparison(): Renders forest plot with univariate and multivariate estimates grouped by variableprint.breg_comparison(): S3 print method for comparison objectsUsage
The forest plot displays each variable's estimates from both models, showing how effects change when adjusted for other predictors (e.g., ph.karno: HR=0.988, p=0.04 univariate → HR=1.02, p=0.11 multivariate).
Works with all model types (Cox, logistic, linear) and handles continuous/categorical variables. Added 12 tests covering various scenarios.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.